﻿using FunctionScope.Binding;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace FunctionScope.Models
{
    [DataContract(Name = "Trace2DPlotSettingsModel", Namespace = "wpfscope.codeplex.com")]
    public class Trace2DPlotSettingsModel : BindableObject
    {

        public Trace2DPlotSettingsModel()
        {

        }

        public Trace2DPlotSettingsModel(Trace2DPlotSettingsModel source)
        {
            Copy(source);
        }

        public Trace2DPlotSettingsModel Clone()
        {
            return new Trace2DPlotSettingsModel(this);
        }

        public void Copy(Trace2DPlotSettingsModel source)
        {
            PersistenceMS = source.PersistenceMS;
            ShowGraticule = source.ShowGraticule;
        }

        private int _persistenceMS;

        [DataMember]
        public int PersistenceMS
        {
            get
            {
                return _persistenceMS;
            }
            set
            {
                if (_persistenceMS != value)
                {
                    _persistenceMS = value;
                    RaisePropertyChanged("PersistenceMS");
                }
            }
        }

        private bool _showGraticule;

        [DataMember]
        public bool ShowGraticule
        {
            get
            {
                return _showGraticule;
            }
            set
            {
                if (_showGraticule != value)
                {
                    _showGraticule = value;
                    RaisePropertyChanged("ShowGraticule");
                }
            }
        }

        private bool _subPixelRendering;

        [DataMember]
        public bool SubpixelRendering
        {
            get
            {
                return _subPixelRendering;
            }
            set
            {
                if (_subPixelRendering != value)
                {
                    _subPixelRendering = value;
                    RaisePropertyChanged("SubpixelRendering");
                }
            }
        }

        private TraceModel<double> _trace;

        public TraceModel<double> Trace
        {
            get
            {
                return _trace;
            }
            set
            {   
                _trace = value;
                RaisePropertyChanged("Trace");
            }
        }
    }
}
